//
//  YDYLoginandRegisterTextField.m
//  DYSisterAPP
//
//  Created by 杨德勇 on 16/7/27.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

#import "YDYLoginandRegisterTextField.h"
#import "UITextField+YDYExtension.h"

@implementation YDYLoginandRegisterTextField

-(void)awakeFromNib{
    [super awakeFromNib];
    self.tintColor = [UIColor lightGrayColor];
    self.textColor = [UIColor whiteColor];
    self.ydy_placeholderColor = [UIColor lightGrayColor];
    
    
  
   
    /** 
     想实现placeholder的字体颜色改变有几种方法
     1.用自定义字符串NSAttributedString
     2.用draw方法，自己摸索到应该画的点
     3.用runtime获取textfield的隐藏属性,然后kvc改值
     [self setValue:[UIColor whiteColor] forKeyPath:@"placeholderLabel.textColor"];

     */
    [self addTarget:self action:@selector(startEdit) forControlEvents:UIControlEventEditingDidBegin];
    [self addTarget:self action:@selector(endEdit) forControlEvents:UIControlEventEditingDidEnd];

    
}

-(void)startEdit{
    self.ydy_placeholderColor = [UIColor whiteColor];
//    [self setValue:[UIColor whiteColor] forKeyPath:@"placeholderLabel.textColor"];
    

    
}
-(void)endEdit{
//    [self setValue:[UIColor grayColor] forKeyPath:@"placeholderLabel.textColor"];
     self.ydy_placeholderColor = [UIColor lightGrayColor];
}

@end
